import { ElButton as Button } from "element-plus";
export default (
  handeEdit?: Function,
  handleDel?: Function,
  t?: (arg0: string) => string
) => [
  {
    type: "selection",
    width: "55",
  },
  {
    prop: "name",
    label: "名字",
    render(h: any, scope: { $index: any; row: any }) {
      const { $index: index, row } = scope;
      return <div>{"==" + row.name + index + "=="}</div>;
    },
  },
  {
    prop: "address",
    label: "地址",
  },
  { prop: "date", label: "日期" },
  {
    prop: "action",
    label: "操作",
    render(h: any, scope: { $index: any; row: any }) {
      const { $index: index, row } = scope;
      return (
        <div>
          <Button
            type="primary"
            link
            onClick={() => {
              (handeEdit as Function)(row);
            }}
          >
            {t!("table.edit")}
          </Button>
          <Button
            type="primary"
            link
            onClick={() => {
              (handleDel as Function)(row.id);
            }}
          >
            {t!("table.delete")}
          </Button>
        </div>
      );
    },
  },
];
